package net.sunofbeach.blog.dao;

import net.sunofbeach.blog.pojo.Navigation;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

public interface NavigationDao extends JpaRepository<Navigation, String>, JpaSpecificationExecutor<Navigation> {


    Navigation findOneById(String id);

    Navigation findOneByState(String state);
    @Modifying
    int deleteAllById(String navigationId);


    @Modifying
    @Query(nativeQuery = true, value = "UPDATE `tb_navigation` SET `state` = '0' WHERE  id = ?")
    int deleteNavigationByState(String navigationId);



}
